package com.leyou.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leyou.item.entity.Sku;
import org.apache.ibatis.annotations.Update;

import java.util.Map;

/**
 * @author BaiZY on 2020/8/26.
 * @version 1.0
 */
public interface SkuMapper extends BaseMapper<Sku> {
    @Update("update tb_sku set stock=stock - #{num},sold= sold + #{num} where id = #{id}")
    void deductStock(Map<String, Object> map);

    @Update("update tb_sku set stock=stock + #{num},sold= sold - #{num} where id = #{id}")
    void plusStock(Map<String,Object> map);
}
